<template>
	<scroll-view scroll-y class="container flex-column">
		<view class="flex-column list-box">
			<view class="box-for flex-justify-content-space-around" v-for="(item,index) in dataList" :key="index" @click="listarae(item.id)">
				<view class="bog-box flex-row">
					<view class="box-img-left">
						<image class="fun-img" :src="item.photo"></image>
					</view>
					<view class="box-right flex-column">
						<view class="box-title-top fun-font-14px flex-directionrow-wrap">{{item.title}}</view>
						<view class="box-bottom flex-direction-row-between">
							<text class="fun-font-13px">{{item.type}}</text>
							<text class="fun-font-13px">{{item.createTime.slice(0,10)}}</text>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view v-show="isavailabe"  class="flex-column flex-center font-color-999 available-box fun-font-14px">
			<image :src="noInfoUrl" style="width: 200rpx;height: 200rpx;"></image>
			<text style="font-weight: 600; margin-top: 20rpx;">{{available}}</text>
		</view>
		<uni-pagination  style=" z-index: 999; position: fixed; bottom: 20rpx;width: 100%;" :current="page" title="标题文字" :total="total" :pageSize="limit" @change="change"></uni-pagination>
	</scroll-view>
</template>

<script>
	import uniPagination from '@/components/uni-pagination/uni-pagination.vue'
	import uniNavBar from "@/components/uni-nav-bar/uni-nav-bar.vue"
	import {
		getProblemList,
		getProblemContent
	} from '@/api/user/index.js'
	export default {
		components: {
			uniNavBar,
			uniPagination
		},
		data() {
			return {
				page:1,
				limit:10,
				total:0,
				noInfoUrl: require("@/static/img/noinfo.png"),
				isavailabe: false,
				available: '暂无数据...',
				list: '文章列表',
				type: '',
				problemid: '',
				dataList: []
			}
		},
		onLoad(op) {
			console.log(this.$store.getters.getEquipmentInfo)
			this.getList()
		},
		methods: {
			getList(){
				this.type = this.$store.getters.getEquipmentInfo.type
				if (typeof this.type == "undefined" || this.type == null || this.type == "") {
					this.isavailabe = true
				} else {
					getProblemList(this.type,this.limit,this.page).then((res) => {
						if(res.result.data.length == 0){
							this.isavailabe = true
						}else{
							this.dataList = res.result.data
							this.problemid = res.result.data.id	
						}
						console.log(this.dataList)
					})
				}
			},
			listarae(id) {
				console.log(id)
				uni.navigateTo({
					url: '/pages/index/proposal/titleimg?id=' + id
				})
			},

			onleft() {
				uni.redirectTo({
					url: '/pages/index/maintain/maintain'
				})
			},
			/**
			 * 分页上一页下一页事件
			 * 
			 */
			change(type,current){
				this.page = type.current
				this.getList()
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		width: 100%;
		/* height: 1240rpx; */
		height: calc(100vh - 44px);
		background-color: #efeff4;

		.navigation-box {
			background-color: #FFFFFF;
			border-bottom: 2rpx solid #999999;
			position: fixed;

			.navigation-text {
				text-align: center;
			}
		}

		.list-box {
			width: 100%;
			bottom: 0;

			.box-for {
				width: 100%;
				background-color: #FFFFFF;

				.bog-box {
					width: 95%;
					padding: 22rpx 30rpx;
					border-bottom: 2rpx solid #efeff4;
					background-color: #FFFFFF;
					height: 150rpx;

					.box-img-left {
						width: 180rpx;
						height: 150rpx;
					}

					.box-right {
						width: 74%;
						height: 150rpx;
						padding-left: 20rpx;

						.box-title-top {
							width: 100%;
							height: 80rpx;
							text-align: center;
						}

						.box-bottom {
							width: 100%;
							height: 30rpx;
							color: #999999;
							bottom: 0;
						}
					}
				}
			}
		}

		.available-box {
			height: 600rpx;
			
		}

	}
</style>
